class Solution(object):
    def minimumSum(self, num):
        out = []
        while num > 0:
            out.append(num % 10)
            num //= 10
        out.sort()
        return out[0] * 10 + out[1] * 10 + out[2] + out[3]
